package com.yunxi.service.dubboService.impl.sat;

import com.github.pagehelper.PageInfo;
import com.yunxi.model.sat.MsgTemplate;
import com.yunxi.sat.pojo.MsgTemplateVO;
import com.yunxi.sat.service.MsgTemplateDubboService;
import com.yunxi.service.localService.sat.MsgTemplateService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import java.util.List;

/**
 * <p>
 * 消息模板 服务实现类
 * </p>
 *
 * @author caoYong
 * @since 2019-08-21
 */
public class MsgTemplateDubboServiceImpl implements MsgTemplateDubboService {

    @Autowired
    @Qualifier(value = "msgTemplateServiceImpl")
    MsgTemplateService msgTemplateService;


    @Override
    public MsgTemplateVO getById(String id) throws Exception {
        MsgTemplate msgTemplate = msgTemplateService.getById(id);
        MsgTemplateVO msgTemplateVO = new MsgTemplateVO();
        BeanUtils.copyProperties(msgTemplate, msgTemplateVO);
        return msgTemplateVO;
    }

    @Override
    public void saveOrUpdate(MsgTemplateVO msgTemplateVO) throws Exception {
        MsgTemplate msgTemplate = new MsgTemplate();
        BeanUtils.copyProperties(msgTemplateVO, msgTemplate);
        msgTemplateService.saveOrUpdate(msgTemplate);
    }

    @Override
    public void removeById(String id) {
        msgTemplateService.removeById(id);
    }

    @Override
    public PageInfo<MsgTemplateVO> findPageByVO(MsgTemplateVO msgTemplateVO, Integer pageNum, Integer pageSize) throws Exception {
        PageInfo<MsgTemplateVO> pageInfo = msgTemplateService.pageByVo(msgTemplateVO, pageNum, pageSize);
        return pageInfo;
    }

    @Override
    public void removeByListVo(List<MsgTemplateVO> msgTemplateVOList) throws Exception {
        msgTemplateService.removeByListVo(msgTemplateVOList);
    }

    @Override
    public List listByVo(MsgTemplateVO msgTemplateVO) {
        return msgTemplateService.listByVo(msgTemplateVO);
    }
}
